export default function () {
	// 订单状态
	// 0->待付款；1->待发货；2->已发货；3->已完成；4->已关闭；5->无效订单
	const PENDING_PAYMENT = 0;
	const TO_BE_SHIPPED = 1;
	const SHIPPED = 2;
	const COMPLETED = 3;
	const CLOSED = 4;
	const INVALID_ORDER = 5;
	const CANCELLED = 6;
	const AFTER_SALE = 7;
	const ORDER_TABS = [
		{
			name: '全部',
			value: 'null',
		},
		{
			name: '待付款',
			value: PENDING_PAYMENT,
		},
		{
			name: '待发货',
			value: TO_BE_SHIPPED,
		},
		{
			name: '已发货',
			value: SHIPPED,
		},
		{
			name: '已完成',
			value: COMPLETED,
		},
		{
			name: '已关闭',
			value: CLOSED,
		},
		{
			name: '售后',
			value: AFTER_SALE,
		},
		{
			name: '已取消订单',
			value: CANCELLED,
		},
		{
			name: '无效订单',
			value: INVALID_ORDER,
		},
	];

	// 订单国家
	// 0->德国；1->英国；2->美国
	const COUNTRY_GERMANY = 0;
	const COUNTRY_BRITAIN = 1;
	const COUNTRY_USA = 2;

	// 支付方式
	// 1->paypal；2->afterpay; 3->klarna; 4->信用卡
	const PAYMENT_PAYPAL = 1;
	const PAYMENT_AFTERPAY = 2;
	const PAYMENT_KLARNA = 3;
	const PAYMENT_CREDIT_CARD = 4;
	const PAYMENT_LIST = [
		{
			value: '',
			label: '全部',
		},
		{
			value: PAYMENT_PAYPAL,
			label: 'paypal',
		},
		{
			value: PAYMENT_AFTERPAY,
			label: 'afterPay',
		},
		{
			value: PAYMENT_KLARNA,
			label: 'klarna',
		},
		{
			value: PAYMENT_CREDIT_CARD,
			label: '信用卡',
		},
	];

	// 获取支付状态
	const PAYMENT_STATUS_UNPAID = 0;
	const PAYMENT_STATUS_SUCCESS = 1;
	const PAYMENT_STATUS_FAIL = -1;
	const PAYMENT_STATUS_LIST = [
		{
			value: '',
			label: '全部',
		},
		{
			value: PAYMENT_STATUS_UNPAID,
			label: '未支付',
		},
		{
			value: PAYMENT_STATUS_SUCCESS,
			label: '已支付',
		},
		{
			value: PAYMENT_STATUS_FAIL,
			label: '支付失败',
		},
	];
	const PAYMENT_SUCESS_STATUS_LIST = [
		{
			value: '',
			label: '全部',
		},
		{
			value: PAYMENT_STATUS_UNPAID,
			label: '未支付',
		},
		{
			value: PAYMENT_STATUS_SUCCESS,
			label: '已支付',
		},
	];

	// 退货/退款的标识
	const RETURN_GOODS = 0;
	const REFUND = 1;

	// 是否退货状态
	// 是否退款:1、发生退款；2、未退款；3、退款完成
	const REFUND_OCCURRED = 1;
	const NO_REFUND = 2;
	const REFUND_COMPLETED = 3;

	// 退货申请状态
	// 申请状态：0->待处理；1->退货中；2->已完成；3->已拒绝；4->用户撤销
	const RETURNAPPLY_PENDING = 0;
	const RETURNAPPLY_IN_RETURN = 1;
	const RETURNAPPLY_COMPLETED = 2;
	const RETURNAPPLY_REJECTED = 3;
	const RETURNAPPLY_USER_REVOCATION = 4;

	// 订单来源
	// 1：sem = 付费广告渠道，包含 Google Ads 和 Facebook Ads
	// 2：edm = 邮件营销渠道
	// 3：seo = SEO 渠道，包含 Google SEO 和 站内 SEO
	// 4：affiliate = 联盟营销渠道，包含站外联盟营销平台 和 站内联盟营销系统
	// 5：social = 社媒官号推广渠道，包含 FB, Tiktok, Twitter, Instagram, Pinterest
	// 6：csr = 客服渠道，包含售前客服 和 售后客服
	// 7：direct = 直接流量来源
	// 8：other = 不明确来源的订单
	const ORDER_SOURCE_SEM = 1;
	const ORDER_SOURCE_EDM = 2;
	const ORDER_SOURCE_SEO = 3;
	const ORDER_SOURCE_AFFILIATE = 4;
	const ORDER_SOURCE_SOCIAL = 5;
	const ORDER_SOURCE_CSR = 6;
	const ORDER_SOURCE_DIRECT = 7;
	const ORDER_SOURCE_OTHER = 8;
	const ORDER_SOURCE_LIST = [
		{
			value: '',
			label: '全部',
		},
		{
			value: ORDER_SOURCE_SEM,
			label: '付费广告渠道，包含 Google Ads 和 Facebook Ads',
		},
		{
			value: ORDER_SOURCE_EDM,
			label: '邮件营销渠道',
		},
		{
			value: ORDER_SOURCE_SEO,
			label: 'SEO 渠道，包含 Google SEO 和 站内 SEO',
		},
		{
			value: ORDER_SOURCE_AFFILIATE,
			label: '联盟营销渠道，包含站外联盟营销平台 和 站内联盟营销系统',
		},
		{
			value: ORDER_SOURCE_SOCIAL,
			label: '社媒官号推广渠道，包含 FB, Tiktok, Twitter, Instagram, Pinterest',
		},
		{
			value: ORDER_SOURCE_CSR,
			label: '客服渠道，包含售前客服 和 售后客服',
		},
		{
			value: ORDER_SOURCE_DIRECT,
			label: '直接流量来源',
		},
		{
			value: ORDER_SOURCE_OTHER,
			label: '不明确来源的订单',
		},
	];

	// 获取付款状态
	const getStatusText = (params) => {
		let text = '';
		params = params + '';
		switch (params) {
			case PENDING_PAYMENT:
				text = '待付款';
				break;
			case TO_BE_SHIPPED:
				text = '待发货';
				break;
			case SHIPPED:
				text = '已发货';
				break;
			case COMPLETED:
				text = '已完成';
				break;
			case CLOSED:
				text = '已关闭';
				break;
			case CANCELLED:
				text = '已取消';
				break;
			case INVALID_ORDER:
				text = '无效订单';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	// 获取国家文本
	const getCountryText = (params) => {
		let text = '';
		switch (params) {
			case COUNTRY_GERMANY:
				text = '德国';
				break;
			case COUNTRY_BRITAIN:
				text = '英国';
				break;
			case COUNTRY_USA:
				text = '美国';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	// 获取支付文本
	const getPayTypeText = (params) => {
		let text = '';
		switch (params) {
			case PAYMENT_PAYPAL:
				text = 'paypal';
				break;
			case PAYMENT_AFTERPAY:
				text = 'afterpay';
				break;
			case PAYMENT_KLARNA:
				text = 'klarna';
				break;
			case PAYMENT_CREDIT_CARD:
				text = '信用卡';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	// 获取支付状态的文本
	const getIsPayedText = (params = -1) => {
		let text = '';
		switch (params) {
			case 0:
				text = '未支付';
				break;
			case 1:
				text = '已支付';
				break;
			case -1:
				text = '支付失败';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	// 获取是退款/退货的文本
	const getRetreatText = (params) => {
		let text = '';
		switch (params) {
			case RETURN_GOODS:
				text = '退货备注：';
				break;
			case REFUND:
				text = '退款备注：';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	const getReturnApplyStateText = (params) => {
		let text = '';
		switch (params) {
			case RETURNAPPLY_PENDING:
				text = '待处理';
				break;
			case RETURNAPPLY_IN_RETURN:
				text = '退货中';
				break;
			case RETURNAPPLY_COMPLETED:
				text = '已完成';
				break;
			case RETURNAPPLY_REJECTED:
				text = '已拒绝';
				break;
			case RETURNAPPLY_USER_REVOCATION:
				text = '用户撤销';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	const getRefundText = (params) => {
		let text = '';
		switch (params) {
			case REFUND_OCCURRED:
				text = '发生退款';
				break;
			case NO_REFUND:
				text = '未退款';
				break;
			case REFUND_COMPLETED:
				text = '退款完成';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};

	const getOrderSourceText = (params) => {
		let text = '';
		switch (params) {
			case ORDER_SOURCE_SEM:
				text = '付费广告渠道，包含 Google Ads 和 Facebook Ads';
				break;
			case ORDER_SOURCE_EDM:
				text = '邮件营销渠道';
				break;
			case ORDER_SOURCE_SEO:
				text = 'SEO 渠道，包含 Google SEO 和 站内 SEO';
				break;
			case ORDER_SOURCE_AFFILIATE:
				text = '联盟营销渠道，包含站外联盟营销平台 和 站内联盟营销系统';
				break;
			case ORDER_SOURCE_SOCIAL:
				text = '社媒官号推广渠道，包含 FB, Tiktok, Twitter, Instagram, Pinterest';
				break;
			case ORDER_SOURCE_CSR:
				text = '客服渠道，包含售前客服 和 售后客服';
				break;
			case ORDER_SOURCE_DIRECT:
				text = '直接流量来源';
				break;
			case ORDER_SOURCE_OTHER:
				text = '不明确来源的订单';
				break;
			default:
				text = '';
				break;
		}
		return text;
	};
	return {
		PENDING_PAYMENT,
		TO_BE_SHIPPED,
		SHIPPED,
		COMPLETED,
		CLOSED,
		INVALID_ORDER,
		CANCELLED,
		AFTER_SALE,
		ORDER_TABS,
		COUNTRY_GERMANY,
		COUNTRY_BRITAIN,
		COUNTRY_USA,
		PAYMENT_PAYPAL,
		PAYMENT_AFTERPAY,
		PAYMENT_KLARNA,
		PAYMENT_CREDIT_CARD,
		PAYMENT_LIST,
		PAYMENT_STATUS_UNPAID,
		PAYMENT_STATUS_SUCCESS,
		PAYMENT_STATUS_FAIL,
		PAYMENT_STATUS_LIST,
		PAYMENT_SUCESS_STATUS_LIST,
		RETURN_GOODS,
		REFUND,
		REFUND_OCCURRED,
		NO_REFUND,
		REFUND_COMPLETED,
		RETURNAPPLY_PENDING,
		RETURNAPPLY_IN_RETURN,
		RETURNAPPLY_COMPLETED,
		RETURNAPPLY_REJECTED,
		RETURNAPPLY_USER_REVOCATION,
		ORDER_SOURCE_SEM,
		ORDER_SOURCE_EDM,
		ORDER_SOURCE_SEO,
		ORDER_SOURCE_AFFILIATE,
		ORDER_SOURCE_SOCIAL,
		ORDER_SOURCE_CSR,
		ORDER_SOURCE_DIRECT,
		ORDER_SOURCE_OTHER,
		ORDER_SOURCE_LIST,
		getStatusText,
		getCountryText,
		getPayTypeText,
		getIsPayedText,
		getRetreatText,
		getReturnApplyStateText,
		getRefundText,
		getOrderSourceText,
	};
}
